#!/bin/bash

host=$1
int=0;

if [ $# -lt 1 ]; then
	echo "Falta el parametro requerido del nombre de host a configurar."
	echo "Uso: $0 [Nombre_de_host]";
	echo "";
	exit;
fi;

#uno=`ping -c 3 -l 3 -W 2 $host 2>&1 | grep -E "(100% packet loss|unknown host)" | wc -l`;
#if [ "$uno" != 1 ]; then
#	echo "No estoy seguro de que el destino no exista.";
#	exit;
#fi;

bash levantar_interfaces.sh $1;

configurado="";
if [ "$host" == "Merry" ]; then
	echo "==Agregando caminos==";
	echo "Rutas directas:"
		route add -net 172.16.99.0   netmask 255.255.255.192 gw Frodo eth0:1 metric 2; #->Red_1
#		route add -net 172.16.99.0   netmask 255.255.255.192 gw Pippin eth0:0 metric 3; #->Red_1-x
#		route add -net 172.16.99.64  netmask 255.255.255.192 gw Pippin eth0:0 metric 2; #->Red_2
#		route add -net 172.16.99.64  netmask 255.255.255.192 gw Frodo eth0:1 metric 2; #->Red_2-x
#		route add -net 172.16.99.128 netmask 255.255.255.192 gw Merry eth0:0 metric 1; #->Red_3
#		route add -net 172.16.99.128 netmask 255.255.255.192 gw Frodo eth0:0 metric 4; #->Red_3-x
#		route add -net 172.16.99.192 netmask 255.255.255.192 gw Merry eth0:0 metric 1; #->Red_4
#		route add -net 172.16.99.192 netmask 255.255.255.192 gw Pippin eth0:0 metric 4s; #->Red_4-x
	echo $host;

elif [ "$host" == "Legolas" ]; then
	echo "==Agregando caminos==";
	echo "Rutas directas:"
	echo $host;

else
	echo "No se tiene la configuración.";
fi;

